
const express = require('express')
const router = express.Router()

// 获取冷链车辆列表
router.get('/vehicles', (req, res) => {
  const vehicles = [
    {
      id: 'CV-001',
      driver: '张师傅',
      route: '中央仓 → 门店A',
      temperature: 2.5,
      targetTemp: 2,
      status: '正常',
      lastUpdate: '2024-11-01 10:25:00'
    },
    {
      id: 'CV-002',
      driver: '李师傅',
      route: '区域分仓 → 门店B',
      temperature: 3.8,
      targetTemp: 4,
      status: '正常',
      lastUpdate: '2024-11-01 10:20:00'
    }
  ]
  res.json(vehicles)
})

// 获取GPS轨迹
router.get('/gps/:vehicleId', (req, res) => {
  const { vehicleId } = req.params
  const gpsData = [
    {
      lat: 39.9042,
      lng: 116.4074,
      timestamp: '2024-11-01 09:00:00',
      speed: 60
    },
    {
      lat: 39.9142,
      lng: 116.3974,
      timestamp: '2024-11-01 09:30:00',
      speed: 55
    }
  ]
  res.json({ vehicleId, gpsData })
})

module.exports = router
